#pragma once

#include "Headers.h"
#include "DirectX Headers.h"
#include "Light.h"

#define g_numTextures 1

class Graphics
{
private:
	Graphics();
	IDirect3DDevice9*		m_pD3DDevice;
	HWND					m_hWnd;
	RECT					m_rClientRect;
	D3DPRESENT_PARAMETERS	m_D3DParams;

	//Light
	///////////////////////////////////////////////////
	LightObject				m_clCharacterLight;
	///////////////////////////////////////////////////

	//DirectX Camera
	///////////////////////////////////////////////////
	D3DXMATRIX				m_matView;
	D3DXMATRIX				m_matPerspective;
	///////////////////////////////////////////////////

	//DirectX Sprites
	///////////////////////////////////////////////////
	ID3DXSprite*			m_pSpriteDevice;
	///////////////////////////////////////////////////

	TexturePack				m_stpTextureDefault;
	TexturePack				m_stpTextureBuffer[g_numTextures];
	char*					m_cszTextureNameBuffer[g_numTextures];

	//DirectX Specific Functions
	///////////////////////////////////////////////////
	ID3DXFont*				m_pD3DFont;
	RECT					m_DebugFontScreenPosition;
	std::ostringstream		m_DebugTextBuffer;
	///////////////////////////////////////////////////

	//DirectX Specific Functions
	///////////////////////////////////////////////////
	bool InitDevice();
	bool InitFont();
	bool InitTextures();
	///////////////////////////////////////////////////
public:
	~Graphics();
	inline static Graphics* Access()
	{static Graphics G;return &G;}

	bool Initialize(HWND hWnd);

	void AddToDebugText(std::string S){m_DebugTextBuffer << S;}

	void Draw();

	void RenderText();
	
	void RenderObjects();
};